<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>

<%@page import="java.util.*,model.*,util.*,control.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../css/front.css" rel="stylesheet" type="text/css" />
<link href="../css/frontstyle.css" rel="stylesheet" type="text/css" />
  <title>校社联_文件管理</title>
  <script>
  	$(function(){
				//添加隔行换色
				$("tbody tr:odd").addClass("oddTR");
				
				// 添加鼠标经过样式
				$("tbody tr").mouseover(function(){
					$(this).addClass("mouseOverTR");
					$(this).children("td").each(function(){
						$(this).addClass("mouseOverTD");
						});
				});
					
				
				$("tbody tr").mouseout(function(){
					$(this).removeClass(["mouseOverTR"]);
					$(this).children("td").each(function(){
							$(this).removeClass(["mouseOverTD"]);
						});
					});
			})
			
			function add(){
				window.location.href="http://www.baidu.com";
				return false;
			}
  </script>

  </head>
  
  <body>
    

<div id="fronttop">
  <div class="fronttou">
    <img src="../pictures/shidaxiaohui.jpg" width="149" height="105" />
    东北师范大学学生社团联合会
</div>
  <div id="fronttopnavigation">
    <table width="995" height="50" border="0" align="center">
      <tr>
        <td width="71"><div align="center" class="STYLE2" ><a href="../index.jsp">首页</a></div></td>
        <td width="71"><div align="center" ><span  class="STYLE2"><a href="../shetuanjieshao.jsp">社团介绍</a></span></div></td>
        <td width="71"><div align="center" ><span  class="STYLE2"><a href="../darenxiu.jsp">达人秀</a></span></div></td>
        <td width="71"><div align="center" ><span  class="STYLE2"><a href="../shetuanxinwen.jsp">社团新闻</a></span></div></td>
        <td width="71"><div align="center" ><span  class="STYLE2"><a href="../sheliandongtai.jsp">社联动态</a></span></div></td>
        <td width="71"><div align="center" ><span  class="STYLE2"><a href="../huodonggonggao.jsp">活动公告</a></span></div></td>
        <td width="71"><div align="center" ><span  class="STYLE2"><a href="../gongtongguanzhu.jsp">共同关注</a></span></div></td>
        <td width="71"><div align="center" ><span  class="STYLE2"><a href="../resources/resources_download.jsp">文件下载</a></span></div></td>
        <td width="71"><div align="center" class="STYLE2"><a href="woyaoliuyan.jsp">我要留言</a></div></td>
      </tr>
    </table>
  </div>
  <div id="fronttopflash"><img src="../pictures/shida.jpg" width="994" height="260"></div>
</div>
<div id="frontlittlenavigation">
  <table width="990" height="34" border="0">
    <tr>
      <td width="984">&nbsp;&nbsp;&nbsp;&nbsp;当前位置：<a href="../index.jsp">首页</a>&gt;&gt;消息管理&gt;&gt;列表 </td>
    </tr>
  </table>
</div>
<div id="frontarticle">
  <div id="frontarticlelefthot">
    <table width="236" height="226" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="cebianlan"	 >
      <tr >
        <td height="54"><div align="left" style="font-size:20px"  class="../hengxian">当前用户：校社联</div></td>
      </tr>
      <tr>
        <td height="54"><div align="center" class="hengxian"><a href="../xiaoshelian_xiaoxiguanli.jsp"><h3>消息管理</h3></a></div></td>
      </tr>
      <tr>
        <td height="54"><div align="center" class="hengxian"><a href="../liuyanban_list2.jsp"><h3>留言板管理</h3></a></div></td>
      </tr>
      <tr>
        <td height="54"><div align="center" class="hengxian"><a href="resources.jsp"><h3>文件管理</h3></a></div></td>
      </tr>
      <tr>
        <td height="54"><div align="center" class="hengxian"><a href="../xiaoshelian_shetuanguanli.jsp"><h3>社团管理</h3></a></div></td>
      </tr>
       <tr>
        <td height="54"><div align="center" class="hengxian"><a href="../xiaoshelian_qitahuodong.jsp"><h3>其他活动管理</h3></a></div></td>
      </tr>
    </table>
  </div>
  <div id="frontarticlemain" class="cebianlan">
    	<div>
		<h2 class="title">资源列表</h2>
		<table width="700px" border="1" cellspacing="0" cellpadding="0" >
			<tr>
				<th>编号</th>
				<th class="left">资源名称</th>
				<th>资源类型</th>
				<th>下载次数</th>
				<th>上传时间</th>
				<th>路径</th>
				<th>介绍</th>
				<th>上传者</th>
				<th>推荐否</th>
				<th>操作</th>
				<th>操作</th>
			</tr>
			<%
				request.setCharacterEncoding("UTF-8");
				String name=ParamUtil.getString(request,"name",null);
				String key=ParamUtil.getString(request,"r_key",null);
				String type=ParamUtil.getString(request,"r_type",null);
				
				String sort_field_1=ParamUtil.getString(request,"sort_field_1",null);
				if(sort_field_1==null)sort_field_1="uploadtime";
	            String sort_field_2=ParamUtil.getString(request,"sort_field_2",null);
				if(sort_field_2==null)sort_field_2="id";
				
	            int pages = ParamUtil.getInt(request, "pages", 1);
			    int rowsPerPage = ParamUtil.getInt(request, "pageSize", 10);
			    ResourcesControl rc = new ResourcesControl();
				Resources resources = new Resources();
				List<Resources> list = new ArrayList<Resources>();
				if(name!=null)
				{
				   list = (List) rc.getResources(pages,rowsPerPage,name); 
				}
				else if(type!=null&&key!=null){
				  list = (List) rc.getResources_1(pages, rowsPerPage,type,key);
				} 
				else
				{
				   list = (List) rc.getResources_2(pages, rowsPerPage,sort_field_1,sort_field_2);
				}       
				for (int i = 0; i < list.size(); i++) {
					resources = list.get(i);
					
			%>
			<tbody>
			<tr>
			    <td><%=resources.getId()%></td>
				<td class="left"><%=resources.getName()%></td>
				<td><%=resources.getType()%></td>
				<td><%=resources.getDownloadtimes()%></td>	
				<td><%=resources.getUploadtime()%></td>	
				<td><%=resources.getPath()%></td>
				<td><%=resources.getIntroduction()%></td>
				<td><%=resources.getUploaduserId()%></td>
			    <td><%=resources.getIsRecommend()%></td>
				
				<td>
				<a href="resources_update.jsp?id=<%=resources.getId()%>">信息修改</a>
				</td>
				<td>
				<a href="resources_delet_chuli.jsp?id=<%=resources.getId()%>">删除</a>
				</td>
			</tr>
			<%
			}
			%>
			</tbody>
			<tfoot>
			
			</tfoot>
		</table>
			 
	    <p>
	    <%
			if(type!=null&&key!=null){
			out.println(ResourcesControl.pageInstance.getToolsMenu_1(pages,type,key));
			}
			else if(sort_field_1!=null){
			out.println(ResourcesControl.pageInstance.getToolsMenu_2(pages,sort_field_1,sort_field_2));
				}

	  %>
          <input type="button" value="上传资源"
		  onclick="window.location.href='resources_add.jsp'" />
	  </p>
	  <p>
		  <input type="button" value="批量上传资源"
		  onclick="window.location.href='many_resources_add.jsp'" />
	  </p>
	  <form name = "form" action="resources.jsp" method="post">
		<p>
		
			按资源名称查找：
			                <input type="text" name="name" />
			                <input type="submit" name="submit" value="提交"/>
			                <input type="reset" value="清除"/>
		</p>
		<p>
		请选择需要查找的操作字段：
		<select  name="r_type" >
		            <option value = "id" >id</option>
					<option value = "name" >资源名称</option>
					<option value = "type" >资源类型</option>
			
		</select>
		查询关键字：<input type="text" name = "r_key"/>				
						<input type="submit" name="submit" value="提交"/>
		                <input type="reset" value="清除"/>
	   </p>
	</form>	
</div>
  </div>
  <div id="apDiv1">

    <div id="frontcopyright">
      <div></div>
      <div>&nbsp;</div>
      <div>
        <div align="center"> 2012-2050 东北师范大学学生社团联合会</div>
      </div>
      <div> </div>
      <div>
        <div align="center">制作：杜娟 吴琼 张宇梁 张建颖 焦书海 张家鑫</div>
      </div>
      <div>&nbsp;</div>
      <div>&nbsp;</div>
    </div>
  </div>
</div>
    
  </body>
</html>
